import Vue from "vue";
import App from "./App.vue";
import store from "@/store";
import {
  Button,
  Message,
  Notification,
  Switch,
  Slider,
  InputNumber,
  Tooltip,
  Dropdown,
  DropdownMenu,
  DropdownItem,
  Input,
  Select,
  Option,
  Dialog,
  Form,
  FormItem,
  Row,
  Col,
  Popover,
  Popconfirm,
} from "element-ui";
import "element-ui/lib/theme-chalk/base.css";
// import CollapseTransition from "element-ui/lib/transitions/collapse-transition";
import "@/eventBus.js"; // 事件总线
import "amfe-flexible"; // 适配移动端
import "utils/rem.js";
import FastClick from "fastclick"; // 解决移动端click事件300ms延迟问题

// 加载动画
import vLoading from "@/directives/loading";
Vue.directive("loading", vLoading); // 这里不一定要是loading这个名字, 取其他的也可以

Vue.config.productionTip = false;
Vue.use(Button);
Vue.use(Switch);
Vue.use(Slider);
Vue.use(InputNumber);
Vue.use(Tooltip);
Vue.use(Dropdown);
Vue.use(DropdownMenu);
Vue.use(DropdownItem);
Vue.use(Input);
Vue.use(Select);
Vue.use(Option);
Vue.use(Dialog);
Vue.use(Form);
Vue.use(FormItem);
Vue.use(Row);
Vue.use(Col);
Vue.use(Popover);
Vue.use(Popconfirm);
// Vue.component(CollapseTransition.name, CollapseTransition);
Vue.prototype.$notify = Notification; // 右侧通知
Vue.prototype.$message = Message; // 上方弹窗

// 初始化FastClick实例。在页面的DOM文档加载完成后
// 使用过程中存在的bug
FastClick.attach(document.body);
FastClick.prototype.onTouchEnd = function (event) {
  if (
    event.target.hasAttribute("type") &&
    event.target.getAttribute("type") == "text"
  ) {
    event.preventDefault();
    return false;
  }
};

new Vue({
  store,
  render: (h) => h(App),
}).$mount("#app");
